/* Updated Replication file for "Domestic Institutions and Wartime Casualties" by Horowitz, Simpson, and Stam */
/* Note 1.0: Some cases where there was a lot of missing data have been dropped */
/* Note 2.0: This data is continually being updated as part of ongoing research by the authors. This means the tables may be slighty off from what appears in the ISQ article. As of the last update on 4/17/12, the recent updates actually strengthen the results. If you have questions, please contact horom (at) sas.upenn.edu */
/* Note 3.0: When you run this .do file, you will notice some changes. For example, some of the values in Table 4 change. However, the changes are in the direction predicted by our theory */

cd XXXXXXX

log using HSS_ISQ_Modified_Replication.log, replace

#delimit; 

/* Load Dataset */
use "HSS_ISQ_Replication_2017.dta", clear;

/* Table 1 */
/* Note 3.0: Table 1, like the others, is slightly different than the version in the text of ISQ since this data is A. Updated and B. Includes only cases where we have complete or near complete information */
tabstat finalcas, stats(n min max p50 mean sd);
tabstat finalconscr, stats(n min max p50 mea n sd);
tabstat polity, stats(n min max p50 mean sd);
tabstat init, stats(n min max p50 mean sd);
tabstat terr, stats(n min max p50 mean sd);
tabstat strat, stats(n min max p50 mean sd);
tabstat milper, stats(n min max p50 mean sd);
tabstat milex, stats(n min max p50 mean sd);
tabstat duration, stats(n min max p50 mean sd);

/* Table 2 */
/* Democratic Volunteer Initiators */
tabstat finalcas if finalconscr==0 & polity>=17 & polity<=20 & init==1, stats(count min mean);
/* Democratic Conscript Initiators */
tabstat finalcas if finalconscr==1 & polity>=17 & polity<=20 & init==1, stats(count min mean);
/* Autocratic Volunteer Initiators */
tabstat finalcas if finalconscr==0 & polity<=3 & polity>=0 & init==1, stats(count min mean);
/* Autocratic Conscript Initiators */
tabstat finalcas if finalconscr==1 & polity<=3 & polity>=0 & init==1, stats(count min mean);
/* Democratic Volunteer Targets */
tabstat finalcas if finalconscr==0 & polity>=17 & polity<=20 & init==0, stats(count min mean);
/* Democratic Conscript Targets */
tabstat finalcas if finalconscr==1 & polity>=17 & polity<=20 & init==0, stats(count min mean);
/* Autocratic Volunteer Targets */
tabstat finalcas if finalconscr==0 & polity<=3 & polity>=0 & init==0, stats(count min mean);
/* Autocratic Conscript Targets */
tabstat finalcas if finalconscr==1 & polity<=3 & polity>=0 & init==0, stats(count min mean);

/* Table 3 Model 1*/
gnbreg finalcas finalconscr polity init worldwars, lna(terr strat milper milex) exposure (duration) cluster (hsswarnumber) nolog;

/* Table 3 Model 2*/
gnbreg finalcas finalconscr polity init democinit conscriptdemoc conscriptinit conscriptdemocinit worldwars, lna(terr strat milper milex) exposure (duration) cluster (hsswarnumber) nolog;

/* Table 3 Model 3 */
gnbreg finalcas finalconscr polity init existential democexist democinit conscriptdemoc conscriptinit conscriptdemocinit worldwars, lna(terr strat milper milex) exposure (duration) cluster (hsswarnumber) nolog;

/* Table 3 Model 4 */
gnbreg finalcas finalconscr polity init existential worldwars, lna(terr strat milper milex spendtroop year y2 gdppercapita g2) exposure (duration) cluster (hsswarnumber) nolog;

/* Table 3 Model 5 */
gnbreg finalcas finalconscr polity init democinit conscriptdemoc conscriptinit conscriptdemocinit worldwars existential, lna(terr strat milper milex spendtroop year y2 gdppercapita g2) exposure (duration) cluster (hsswarnumber) nolog;

/* Table 3 Model 6 */

cmp setup;


cmp (caslog = finalconscr polity init strat terr duration worldwars) (finalconscr = polity init strat terr duration milex milper spendtroop tpop upop worldwars), ind($cmp_cont $cmp_probit) cluster(hsswarnumber);

/* Table 3, Model 7*/
ivprobit finalcas2 polity init strat terr duration worldwars (finalconscr = milex milper spendtroop tpop upop), cluster(hsswarnumber);

/* Table 4, Full Dataset */
gnbreg finalcas finalconscr polity init democinit conscriptdemoc conscriptinit conscriptdemocinit worldwars, lna(terr strat milper milex) exposure (duration) cluster (hsswarnumber) nolog;

predict yhat;  
gen residual = yhat-finalcas; 
gen resratio = residual/finalcas;     
/* init =0, conscr =0, polity= 3 */;  
recode finalconscr *=0;  
recode init *=0;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0;  
predict y_VAT;     

/* init =0, conscrip =1, polity= 3 */;  
recode finalconscr *=1; 
recode init *=0;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=3;  
predict y_CAT;     

/* init =0, concscrip =0, polity =17 */;  
recode finalconscr *=0; 
recode init *=0;  
recode polity *=17; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0;  
predict y_VDT;   

/* init =0, conscript =1, polity =17 */;  
recode finalconscr *=1; 
recode init *=0; 
recode polity *=17; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=17;  
predict y_CDT;   

/* init =1, conscrip =0, polity =3 */;  
recode finalconscr *=0; 
recode init *=1;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0;  
predict y_VAI;     

/* init *=1, conscript =1, polity =3 */;  
recode finalconscr *=1; 
recode init *=1;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=1; 
recode conscriptdemocinit *=3; 
recode conscriptdemoc *=3;   
predict y_CAI;     

/* init =1, conscrip =0, polity =17 */;  
recode finalconscr *=0; 
recode init *=1;  
recode polity *=17; 
recode democinit *=17;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0; 
predict y_VDI;    

/* conscr =1, init =1, polity =17 */;  
recode finalconscr *=1; 
recode init *=1;  
recode polity *=17; 
recode democinit *=17;
recode conscriptinit *=1; 
recode conscriptdemocinit *=17; 
recode conscriptdemoc *=17;  
predict y_CDI;  

tabstat y_VAT y_CAT  y_VDT y_CDT y_VAI y_CAI y_VDI y_CDI, stats(mean q sd); 

/* Box plot with outliers in Appendix 2 */
graph box y_CDI y_VDI y_CAI y_VAI y_CDT y_VDT y_CAT y_VAT, legend(off);

clear;

/* Table 4, Excluding Outliers - world wars variable also excluded since dropping outliers */
use "HSS_ISQ_Replication3.0.dta", clear;
drop if finalcas>=1000000;

gnbreg finalcas finalconscr polity init democinit conscriptdemoc conscriptinit conscriptdemocinit, lna(terr strat milper milex) exposure (duration) cluster (hsswarnumber) nolog;

predict yhat;  
gen residual = yhat-finalcas; 
gen resratio = residual/finalcas;     
/* init =0, conscr =0, polity= 3 */;  
recode finalconscr *=0;  
recode init *=0;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0;  
predict y_VAT;     

/* init =0, conscrip =1, polity= 3 */;  
recode finalconscr *=1; 
recode init *=0;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=3;  
predict y_CAT;     

/* init =0, concscrip =0, polity =17 */;  
recode finalconscr *=0; 
recode init *=0;  
recode polity *=17; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0;  
predict y_VDT;   

/* init =0, conscript =1, polity =17 */;  
recode finalconscr *=1; 
recode init *=0; 
recode polity *=17; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=17;  
predict y_CDT;   

/* init =1, conscrip =0, polity =3 */;  
recode finalconscr *=0; 
recode init *=1;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0;  
predict y_VAI;     

/* init *=1, conscript =1, polity =3 */;  
recode finalconscr *=1; 
recode init *=1;  
recode polity *=3; 
recode democinit *=0;
recode conscriptinit *=1; 
recode conscriptdemocinit *=3; 
recode conscriptdemoc *=3;   
predict y_CAI;     

/* init =1, conscrip =0, polity =17 */;  
recode finalconscr *=0; 
recode init *=1;  
recode polity *=17; 
recode democinit *=17;
recode conscriptinit *=0; 
recode conscriptdemocinit *=0; 
recode conscriptdemoc *=0; 
predict y_VDI;    

/* conscr =1, init =1, polity =17 */;  
recode finalconscr *=1; 
recode init *=1;  
recode polity *=17; 
recode democinit *=17;
recode conscriptinit *=1; 
recode conscriptdemocinit *=17; 
recode conscriptdemoc *=17;  
predict y_CDI;  

tabstat y_VAT y_CAT  y_VDT y_CDT y_VAI y_CAI y_VDI y_CDI, stats(mean q sd); 

/* Box plot without outliers in Appendix 2 */
graph box y_CDI y_VDI y_CAI y_VAI y_CDT y_VDT y_CAT y_VAT, legend(off);

clear;

/* Figure 1 created in excel using the finalcas variable - please contact authors for information at horom (at) sas.upenn.edu */

/* Data for Figures 2-3 */
use "HSS_ISQ_Replication3.0.dta", clear;
drop if finalcas>=1000000;

/* Table 3 Model 2 - modified */
gnbreg finalcas finalconscr polity init democinit conscriptdemoc conscriptinit conscriptdemocinit, lna(terr strat milper milex) exposure (duration) cluster (hsswarnumber) nolog;

/* Generating the Figures */
 predict yhat;
 gen residual = yhat-finalcas;
 gen resratio = residual/finalcas;   
 
/*Volunteer Targets*/ /*init=0, conscr=0*/ 
 recode finalconscr *=0;  
recode init *=0;  
recode democinit *=0;
recode conscriptinit *=0;
recode conscriptdemocinit *=0;
recode conscriptdemoc *=0;
 recode polity *=0;
predict y_VT0;  

recode polity *=1;
predict y_VT1;  

recode polity *=2;
predict y_VT2;  

recode polity *=3;
predict y_VT3;  

recode polity *=4;
predict y_VT4;  

recode polity *=5;
predict y_VT5;  
 recode polity *=6;
predict y_VT6;  

recode polity *=7;
predict y_VT7;  
 recode polity *=8;
predict y_VT8;  

recode polity *=9;
predict y_VT9;  
  
recode polity *=10;
predict y_VT10;  
 
recode polity *=11;
predict y_VT11;  
 
recode polity *=12;
predict y_VT12;  
 
recode polity *=13;
predict y_VT13;

recode polity *=14;
predict y_VT14;  
 
recode polity *=15;
predict y_VT15;  
 
recode polity *=16;
predict y_VT16;  
 
recode polity *=17;
predict y_VT17;  
 
recode polity *=18;
predict y_VT18;  
 
recode polity *=19;
predict y_VT19;  
 
recode polity *=20;
predict y_VT20;  

/*Conscript Targets*/ /*init=0, conscrip=1*/ 
 recode finalconscr *=1;
recode init *=0; 
recode democinit *=0;
recode conscriptinit *=0;
recode conscriptdemocinit *=0;
recode conscriptdemoc *=2;
 recode polity *=0;
recode conscriptdemoc *=0;
predict y_CT0;  

recode polity *=1;
recode conscriptdemoc *=1;
predict y_CT1;  

recode polity *=2;
recode conscriptdemoc *=2;
predict y_CT2;  

recode polity *=3;
recode conscriptdemoc *=3;
predict y_CT3;  

recode polity *=4;
recode conscriptdemoc *=4;
predict y_CT4;  

recode polity *=5;
recode conscriptdemoc *=5;
predict y_CT5;  

recode polity *=6;
recode conscriptdemoc *=6;
predict y_CT6;  

recode polity *=7;
recode conscriptdemoc *=7;
predict y_CT7;  

recode polity *=8;
recode conscriptdemoc *=8;
predict y_CT8;  

recode polity *=9;
recode conscriptdemoc *=9;
predict y_CT9;  
  
recode polity *=10;
recode conscriptdemoc *=10;
predict y_CT10;  
 
recode polity *=11;
recode conscriptdemoc *=11;
predict y_CT11;  
 
recode polity *=12;
recode conscriptdemoc *=12;
predict y_CT12;  
 
recode polity *=13;
recode conscriptdemoc *=13;
predict y_CT13;

recode polity *=14;
recode conscriptdemoc *=14;
predict y_CT14;  
 
recode polity *=15;
recode conscriptdemoc *=15;
predict y_CT15;  
 
recode polity *=16;
recode conscriptdemoc *=16;
predict y_CT16;  
 
recode polity *=17;
recode conscriptdemoc *=17;
predict y_CT17;  
 
recode polity *=18;
recode conscriptdemoc *=18;
predict y_CT18;  
 
recode polity *=19;
recode conscriptdemoc *=19;
predict y_CT19;  
 
recode polity *=20;
recode conscriptdemoc *=20;
predict y_CT20;  

/*Volunteer Initiators*/ /*init=1, conscrip=0*/ 
 recode finalconscr *=0;
recode init *=1; 
recode democinit *=0;
recode conscriptinit *=0;
recode conscriptdemocinit *=0;
recode conscriptdemoc *=0;
 recode polity *=0;
recode democinit *=0;
predict y_VI0;  

recode polity *=1;
recode democinit *=1;
predict y_VI1;  

recode polity *=2;
recode democinit *=2;
predict y_VI2;  

recode polity *=3;
recode democinit *=3;
predict y_VI3;  

recode polity *=4;
recode democinit *=4;
predict y_VI4;  

recode polity *=5;
recode democinit *=5;
predict y_VI5;  

recode polity *=6; 
recode democinit *=6;
predict y_VI6;  

recode polity *=7;
recode democinit *=7;
predict y_VI7;  

recode polity *=8;
recode democinit *=8;
predict y_VI8;  

recode polity *=9;
recode democinit *=9;
predict y_VI9;  
  
recode polity *=10;
recode democinit *=10;
predict y_VI10;  
 
recode polity *=11;
recode democinit *=11;
predict y_VI11;  
 
recode polity *=12;
recode democinit *=12;
predict y_VI12;  
 
recode polity *=13;
recode democinit *=13;
predict y_VI13;

recode polity *=14;
recode democinit *=14;
predict y_VI14;  
 
recode polity *=15;
recode democinit *=15;
predict y_VI15;  
 
recode polity *=16;
recode democinit *=16;
predict y_VI16;  
 
recode polity *=17;
recode democinit *=17;
predict y_VI17;  
 
recode polity *=18;
recode democinit *=18;
predict y_VI18;  
 
recode polity *=19;
recode democinit *=19;
predict y_VI19;  
 
recode polity *=20;
recode democinit *=20;
predict y_VI20;

 /*Concript Initiators*/
/*init=1, conscript=1*/
 recode finalconscr *=1;
recode init *=1; 
recode democinit *=0;
recode conscriptinit *=1; 
recode polity *=0;
recode conscriptdemoc *=0;
recode conscriptdemocinit *=0;
predict y_CI0;  

recode polity *=1;
recode democinit *=1;
recode conscriptdemoc *=1;
recode conscriptdemocinit *=1;
predict y_CI1;  

recode polity *=2;
recode democinit *=2;
recode conscriptdemoc *=2;
recode conscriptdemocinit *=2;
predict y_CI2;  

recode polity *=3;
recode democinit *=3;
recode conscriptdemoc *=3;
recode conscriptdemocinit *=3;
predict y_CI3;  

recode polity *=4;
recode democinit *=4;
recode conscriptdemoc *=4;
recode conscriptdemocinit *=4;
predict y_CI4;  

recode polity *=5;
recode democinit *=5;
recode conscriptdemoc *=5;
recode conscriptdemocinit *=5;
predict y_CI5;  

recode polity *=6;
recode democinit *=6;
recode conscriptdemoc *=6;
recode conscriptdemocinit *=6;
predict y_CI6;  

recode polity *=7;
recode democinit *=7;
recode conscriptdemoc *=7;
recode conscriptdemocinit *=7;
predict y_CI7;  

recode polity *=8;
recode democinit *=8;
recode conscriptdemoc *=8;
recode conscriptdemocinit *=8;
predict y_CI8;  

recode polity *=9;
recode democinit *=9;
recode conscriptdemoc *=9;
recode conscriptdemocinit *=9;
predict y_CI9;  

recode polity *=10;
recode democinit *=10;
recode conscriptdemoc *=10;
recode conscriptdemocinit *=10;
predict y_CI10;  

recode polity *=11;
recode democinit *=11;
recode conscriptdemoc *=11;
recode conscriptdemocinit *=11;
predict y_CI11;  

recode polity *=12;
recode democinit *=12;
recode conscriptdemoc *=12;
recode conscriptdemocinit *=12;
predict y_CI12;  

recode polity *=13;
recode democinit *=13;
recode conscriptdemoc *=13;
recode conscriptdemocinit *=13;
predict y_CI13;  

recode polity *=14;
recode democinit *=14;
recode conscriptdemoc *=14;
recode conscriptdemocinit *=14;
predict y_CI14;  

recode polity *=15;
recode democinit *=15;
recode conscriptdemoc *=15;
recode conscriptdemocinit *=15;
predict y_CI15;  

recode polity *=16;
recode democinit *=16;
recode conscriptdemoc *=16;
recode conscriptdemocinit *=16;
predict y_CI16;  

recode polity *=17;
recode democinit *=17;
recode conscriptdemoc *=17;
recode conscriptdemocinit *=17;
predict y_CI17;  

recode polity *=18;
recode democinit *=18;
recode conscriptdemoc *=18;
recode conscriptdemocinit *=18;
predict y_CI18;  

recode polity *=19;
recode democinit *=19;
recode conscriptdemoc *=19;
recode conscriptdemocinit *=19;
predict y_CI19;  

recode polity *=20;
recode democinit *=20;
recode conscriptdemoc *=20;
recode conscriptdemocinit *=20;
predict y_CI20; 

tabstat y_VT0 y_VT1 y_VT2 y_VT3 y_VT4 y_VT5 y_VT6 y_VT7 y_VT8 y_VT9 y_VT10 y_VT11 y_VT12 y_VT13 y_VT14 y_VT15 y_VT16 y_VT17 y_VT18 y_VT19 y_VT20, stats(mean); 

tabstat y_CT0 y_CT1 y_CT2 y_CT3 y_CT4 y_CT5 y_CT6 y_CT7 y_CT8 y_CT9 y_CT10 y_CT11 y_CT12 y_CT13 y_CT14 y_CT15 y_CT16 y_CT17 y_CT18 y_CT19 y_CT20, stats(mean); 

tabstat y_VI0 y_VI1 y_VI2 y_VI3 y_VI4 y_VI5 y_VI6 y_VI7 y_VI8 y_VI9 y_VI10 y_VI11 y_VI12 y_VI13 y_VI14 y_VI15 y_VI16 y_VI17 y_VI18 y_VI19 y_VI20, stats(mean); 

tabstat y_CI0 y_CI1 y_CI2 y_CI3 y_CI4 y_CI5 y_CI6 y_CI7 y_CI8 y_CI9 y_CI10 y_CI11 y_CI12 y_CI13 y_CI14 y_CI15 y_CI16 y_CI17 y_CI18 y_CI19 y_CI20, stats(mean); 

clear;

/* Figure 4 */
clear;
#delimit;

/* Load Dataset */

use "HSS_ISQ_Replication2.0.dta", clear;

gnbreg finalcas finalconscr polity init existential democexist democinit conscriptdemoc conscriptinit conscriptdemocinit worldwars, lna(terr strat milper milex) exposure (duration) cluster (hsswarnumber) nolog;
drop if polity==.;
drop if finalconscr==.;
drop if milex==.;
drop if init==.;

predict yhat; 
gen residual = yhat-finalcas; 
gen resratio = residual/finalcas;   

/*Conscript Non-Existential Targets*/
/*init=0, conscrip=1*/ 
recode existential *=0;
recode finalconscr *=1;
recode init *=0; 
recode democinit *=0;
recode conscriptinit *=0;
recode conscriptdemocinit *=0;
recode conscriptdemoc *=2; 
recode polity *=0;
recode conscriptdemoc *=0;
recode democexist *=0;
predict y_CT0;  

recode polity *=1;
recode conscriptdemoc *=1;
predict y_CT1;  

recode polity *=2;
recode conscriptdemoc *=2;
predict y_CT2;  

recode polity *=3;
recode conscriptdemoc *=3;
predict y_CT3;  

recode polity *=4;
recode conscriptdemoc *=4;
predict y_CT4;  

recode polity *=5;
recode conscriptdemoc *=5;
predict y_CT5;  

recode polity *=6;
recode conscriptdemoc *=6;
predict y_CT6;  

recode polity *=7;
recode conscriptdemoc *=7;
predict y_CT7;  

recode polity *=8;
recode conscriptdemoc *=8;
predict y_CT8;  

recode polity *=9;
recode conscriptdemoc *=9;
predict y_CT9;  
  
recode polity *=10;
recode conscriptdemoc *=10;
predict y_CT10;  
 
recode polity *=11;
recode conscriptdemoc *=11;
predict y_CT11;  
 
recode polity *=12;
recode conscriptdemoc *=12;
predict y_CT12;  
 
recode polity *=13;
recode conscriptdemoc *=13;
predict y_CT13;

recode polity *=14;
recode conscriptdemoc *=14;
predict y_CT14;  
 
recode polity *=15;
recode conscriptdemoc *=15;
predict y_CT15;  
 
recode polity *=16;
recode conscriptdemoc *=16;
predict y_CT16;  
 
recode polity *=17;
recode conscriptdemoc *=17;
predict y_CT17;  
 
recode polity *=18;
recode conscriptdemoc *=18;
predict y_CT18;  
 
recode polity *=19;
recode conscriptdemoc *=19;
predict y_CT19;  
 
recode polity *=20;
recode conscriptdemoc *=20;
predict y_CT20;  


/*Conscript Existential Targets*/
/*init=0, conscrip=1*/ 
recode existential *=1;
recode finalconscr *=1;
recode init *=0; 
recode democinit *=0;
recode conscriptinit *=0;
recode conscriptdemocinit *=0;
recode conscriptdemoc *=2; 
recode polity *=0;
recode conscriptdemoc *=0;
recode democexist *=0;
predict y_CexT0;  

recode polity *=1;
recode conscriptdemoc *=1;
recode democexist *=1;
predict y_CexT1;  

recode polity *=2;
recode conscriptdemoc *=2;
recode democexist *=2;
predict y_CexT2;  

recode polity *=3;
recode conscriptdemoc *=3;
recode democexist *=3;
predict y_CexT3;  

recode polity *=4;
recode conscriptdemoc *=4;
recode democexist *=4;
predict y_CexT4;  

recode polity *=5;
recode conscriptdemoc *=5;
recode democexist *=5;
predict y_CexT5;  

recode polity *=6;
recode conscriptdemoc *=6;
recode democexist *=6;
predict y_CexT6;  

recode polity *=7;
recode conscriptdemoc *=7;
recode democexist *=7;
predict y_CexT7;  

recode polity *=8;
recode conscriptdemoc *=8;
recode democexist *=8;
predict y_CexT8;  

recode polity *=9;
recode conscriptdemoc *=9;
recode democexist *=9;
predict y_CexT9;  
  
recode polity *=10;
recode conscriptdemoc *=10;
recode democexist *=10;
predict y_CexT10;  
 
recode polity *=11;
recode conscriptdemoc *=11;
recode democexist *=11;
predict y_CexT11;  
 
recode polity *=12;
recode conscriptdemoc *=12;
recode democexist *=12;
predict y_CexT12;  
 
recode polity *=13;
recode conscriptdemoc *=13;
recode democexist *=13;
predict y_CexT13;

recode polity *=14;
recode conscriptdemoc *=14;
recode democexist *=14;
predict y_CexT14;  
 
recode polity *=15;
recode conscriptdemoc *=15;
recode democexist *=15;
predict y_CexT15;  
 
recode polity *=16;
recode conscriptdemoc *=16;
recode democexist *=16;
predict y_CexT16;  
 
recode polity *=17;
recode conscriptdemoc *=17;
recode democexist *=17;
predict y_CexT17;  
 
recode polity *=18;
recode conscriptdemoc *=18;
recode democexist *=18;
predict y_CexT18;  
 
recode polity *=19;
recode conscriptdemoc *=19;
recode democexist *=19;
predict y_CexT19;  
 
recode polity *=20;
recode conscriptdemoc *=20;
recode democexist *=20;
predict y_CexT20;  

tabstat y_CT0 y_CT1 y_CT2 y_CT3 y_CT4 y_CT5 y_CT6 y_CT7 y_CT8 y_CT9 y_CT10 y_CT11 y_CT12 y_CT13 y_CT14 y_CT15 y_CT16 y_CT17 y_CT18 y_CT19 y_CT20, stats(mean); 

tabstat y_CexT0 y_CexT1 y_CexT2 y_CexT3 y_CexT4 y_CexT5 y_CexT6 y_CexT7 y_CexT8 y_CexT9 y_CexT10 y_CexT11 y_CexT12 y_CexT13 y_CexT14 y_CexT15 y_CexT16 y_CexT17 y_CexT18 y_CexT19 y_CexT20, stats(mean);

/* Appendix 3 */

use "HSS_ISQ_Replication_2017.dta", clear;

/* Model 1 */
gnbreg finalcas finalconscr polity worldwars, lna(terr strat milper milex spendtroop year gdppercapita) exposure (duration) cluster (hsswarnumber) nolog;

/* Model 2 */
gnbreg finalcas finalconscr polity init existential, lna(terr strat milper milex spendtroop year gdppercapita) exposure (duration) cluster (hsswarnumber) nolog;

/* Model 3: Replicates Model 4 in Table 3 in paper */
gnbreg finalcas finalconscr polity init existential worldwars, lna(terr strat milper milex spendtroop year y2 gdppercapita g2) exposure (duration) cluster (hsswarnumber) nolog;

/* Model 4 */
gnbreg finalcas finalconscr polity init democinit conscriptdemoc conscriptinit conscriptdemocinit worldwars existential, lna(terr strat milper milex spendtroop year gdppercapita) exposure (duration) cluster (hsswarnumber) nolog;

/* Model 5 */
gnbreg finalcas finalconscr polity init democinit conscriptdemoc conscriptinit conscriptdemocinit worldwars existential, lna(terr strat milper milex spendtroop year y2 gdppercapita g2) exposure (duration) cluster (hsswarnumber) nolog;

log close;
